import type { ComponentType } from 'react'
import { BlockEnum } from '../types'
import StartNode from './start/node'
import StartPanel from './start/panel'
import EndNode from './end/node'
import EndPanel from './end/panel'
import AnswerNode from './answer/node'
import AnswerPanel from './answer/panel'
import LLMNode from './llm/node'
import LLMPanel from './llm/panel'
import KnowledgeRetrievalNode from './knowledge-retrieval/node'
import KnowledgeRetrievalPanel from './knowledge-retrieval/panel'
import QuestionClassifierNode from './question-classifier/node'
import QuestionClassifierPanel from './question-classifier/panel'
import IfElseNode from './if-else/node'
import IfElsePanel from './if-else/panel'
import CodeNode from './code/node'
import CodePanel from './code/panel'
import TemplateTransformNode from './template-transform/node'
import TemplateTransformPanel from './template-transform/panel'
import HttpNode from './http/node'
import HttpPanel from './http/panel'
import ToolNode from './tool/node'
import ToolPanel from './tool/panel'
import VariableAssignerNode from './variable-assigner/node'
import VariableAssignerPanel from './variable-assigner/panel'
import AssignerNode from './assigner/node'
import AssignerPanel from './assigner/panel'
import ParameterExtractorNode from './parameter-extractor/node'
import ParameterExtractorPanel from './parameter-extractor/panel'
import IterationNode from './iteration/node'
import IterationPanel from './iteration/panel'
import DocExtractorNode from './document-extractor/node'
import DocExtractorPanel from './document-extractor/panel'
import ListFilterNode from './list-operator/node'
import ListFilterPanel from './list-operator/panel'


import DataOperatorNode from './data-operator/node'
import DataOperatorPanel from './data-operator/panel'
import MetaOperatorNode from './meta-operator/node'
import MetaOperatorPanel from './meta-operator/panel'
import SQLOperatorNode from './sql-operator/node'
import SQLOperatorPanel from './sql-operator/panel'
import WebAssemblyNode from './webassembly/node'
import WebAssemblyPanel from './webassembly/panel'
import HtmlExtractorNode from './html-extractor/node'
import HtmlExtractorPanel from './html-extractor/panel'
import CLINode from './cli/node'
import CLIPanel from './cli/panel'
import SpeechGeneratorNode from './generator/speech-generator/node'
import SpeechGeneratorPanel from './generator/speech-generator/panel'
import VideoGeneratorNode from './generator/video-generator/node'
import VideoGeneratorPanel from './generator/video-generator/panel'
import ImageGeneratorNode from './generator/image-generator/node'
import ImageGeneratorPanel from './generator/image-generator/panel'
import WaitNode from './wait/node'
import WaitPanel from './wait/panel'

export const NodeComponentMap: Record<string, ComponentType<any>> = {
    [BlockEnum.Start]: StartNode,
    [BlockEnum.End]: EndNode,
    [BlockEnum.Answer]: AnswerNode,
    [BlockEnum.LLM]: LLMNode,
    [BlockEnum.KnowledgeRetrieval]: KnowledgeRetrievalNode,
    [BlockEnum.QuestionClassifier]: QuestionClassifierNode,
    [BlockEnum.IfElse]: IfElseNode,
    [BlockEnum.Code]: CodeNode,
    [BlockEnum.TemplateTransform]: TemplateTransformNode,
    [BlockEnum.HttpRequest]: HttpNode,
    [BlockEnum.Tool]: ToolNode,
    [BlockEnum.VariableAssigner]: VariableAssignerNode,
    [BlockEnum.Assigner]: AssignerNode,
    [BlockEnum.VariableAggregator]: VariableAssignerNode,
    [BlockEnum.ParameterExtractor]: ParameterExtractorNode,
    [BlockEnum.Iteration]: IterationNode,
    [BlockEnum.DocExtractor]: DocExtractorNode,
    [BlockEnum.ListFilter]: ListFilterNode,
    //
    [BlockEnum.DataOperator]: DataOperatorNode,
    [BlockEnum.MetaOperator]: MetaOperatorNode,
    [BlockEnum.SQLOperator]: SQLOperatorNode,
    [BlockEnum.WebAssembly]: WebAssemblyNode,
    [BlockEnum.HtmlExtractor]: HtmlExtractorNode,
    [BlockEnum.CLI]: CLINode,
    [BlockEnum.SpeechGenerator]: SpeechGeneratorNode,
    [BlockEnum.VideoGenerator]: VideoGeneratorNode,
    [BlockEnum.ImageGenerator]: ImageGeneratorNode,
    [BlockEnum.Wait]: WaitNode,
}

export const PanelComponentMap: Record<string, ComponentType<any>> = {
    [BlockEnum.Start]: StartPanel,
    [BlockEnum.End]: EndPanel,
    [BlockEnum.Answer]: AnswerPanel,
    [BlockEnum.LLM]: LLMPanel,
    [BlockEnum.KnowledgeRetrieval]: KnowledgeRetrievalPanel,
    [BlockEnum.QuestionClassifier]: QuestionClassifierPanel,
    [BlockEnum.IfElse]: IfElsePanel,
    [BlockEnum.Code]: CodePanel,
    [BlockEnum.TemplateTransform]: TemplateTransformPanel,
    [BlockEnum.HttpRequest]: HttpPanel,
    [BlockEnum.Tool]: ToolPanel,
    [BlockEnum.VariableAssigner]: VariableAssignerPanel,
    [BlockEnum.VariableAggregator]: VariableAssignerPanel,
    [BlockEnum.Assigner]: AssignerPanel,
    [BlockEnum.ParameterExtractor]: ParameterExtractorPanel,
    [BlockEnum.Iteration]: IterationPanel,
    [BlockEnum.DocExtractor]: DocExtractorPanel,
    [BlockEnum.ListFilter]: ListFilterPanel,
    //
    [BlockEnum.DataOperator]: DataOperatorPanel,
    [BlockEnum.MetaOperator]: MetaOperatorPanel,
    [BlockEnum.SQLOperator]: SQLOperatorPanel,
    [BlockEnum.WebAssembly]: WebAssemblyPanel,
    [BlockEnum.HtmlExtractor]: HtmlExtractorPanel,
    [BlockEnum.CLI]: CLIPanel,
    [BlockEnum.SpeechGenerator]: SpeechGeneratorPanel,
    [BlockEnum.VideoGenerator]: VideoGeneratorPanel,
    [BlockEnum.ImageGenerator]: ImageGeneratorPanel,
    [BlockEnum.Wait]: WaitPanel,
}

export const CUSTOM_NODE_TYPE = 'custom'
